import { getBeginTimeOfDay } from "./getBeginTimeOfDay"

/**
 * 当前时间距离明天凌晨的毫秒数
 * @returns {number}
 */
export function getDelayToNextDay(date?: Date | null): number {
  if (date == null) date = new Date()
  const end = getBeginTimeOfDay(date, 1)
  return end.getTime() - date.getTime()
}
